package ZBug;




import info.gridworld.actor.Bug;


public class ZBug extends Bug
{
    private int steps;
    private int sideLength;
    private int times;


    public ZBug(int length)
    {
    	times = 0;
        steps = 0;
        sideLength = length;
        setDirection(90);
    }


    public void act()
    {
        if (steps < sideLength && canMove() && times < 3)
        {
            move();
            steps++;
        }
        else if(steps >= sideLength)
        {
        	if(times == 0){
	            turn();
	            turn();
	            turn();
        	}
        	if(times == 1){
        		turn();
	            turn();
	            turn();
	            turn();
	            turn();
	            
        	}
        	times ++;
	        steps = 0;
        }
        else{}
    }
}
